package live.zs.securitytokenauthorize.config;

import live.zs.securitytokenauthorize.entity.MyUsersEntity;
import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.List;

/**
 * @author madison
 * @description
 * @date 2021/7/17 00:06
 */
@Getter
public class CustomUserDetails extends User {

    private Integer userId;
    private String salt;
    private String phone;
    private String avatar;

    public CustomUserDetails(MyUsersEntity usersEntity, List<GrantedAuthority> authorities){
        super(usersEntity.getUsername(), usersEntity.getPassword(), authorities);
        this.userId = usersEntity.getUserId();
        this.salt = usersEntity.getSalt();
        this.phone = usersEntity.getPhone();
        this.avatar = usersEntity.getAvatar();
    }
}
